﻿using Inovout.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Inovout.Memberships.Models
{
    partial class Membership : DataObject
    {
        public Membership()
        {
        }

        [Required(ErrorMessage = "姓名不可为空")]
        [Alias("姓名")]
        public virtual string Name { get; set; }

        [Required(ErrorMessage = "邮箱地址不可为空")]
        [EmailAddress(ErrorMessage = "请输入正确的电子邮箱格式")]
        [Alias("邮箱地址")]
        public virtual string Email { get; set; }
        //public virtual ISystemUser SystemUser
        //{
        //    get;
        //    set;
        //}
        private Type membershipType;
        public virtual Type MembershipType { get { return this.membershipType; } }

        [Required(ErrorMessage = "手机号码不可为空")]
        [RegularExpression("^1[358][0-9]{9}$", ErrorMessage = "请输入11位有效手机号码")]
        [Alias("手机号码")]
        public virtual string Mobile { get; set; }

        private ISet<Actor> actors;
        public virtual ISet<Actor> Actors 
        {
            get 
            {
                if (actors == null) 
                {
                    actors = new HashSet<Actor>();
                    actors.Add(new GeneralActor(this));
                }
                return actors;
            }
            set { actors = value; }
        }
    }
}
